package com.wl.oss.controller;

import com.wl.connonutils.R;
import com.wl.oss.service.OSSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ Author  ：lei.wan
 * @ Date    ：Created in 2021/8/30
 */
@RestController
@RequestMapping("/eduoss/fileoss")
public class OSSController {

    @Autowired
    OSSService ossService;

    @PostMapping
    public R uploadFile(MultipartFile file){
        //获取上传文件
        String url = ossService.uploadFileAvater(file);
        return R.ok().data("url",url);
    }
}
